﻿using Fleck;
using System;

namespace WebSocketAndPrint
{
    /// <summary>
    /// 为了给WebSocket增加一个昵称的属性
    /// 成员变量的get属性必须有，否则前端不能显示,set可以不要，通过构造器来赋值
    /// </summary>
    public class WebSocket : PropertyStore
    {
        public IWebSocketConnection WebSocketConnection { get; }
        public String NickName { get => Get<String>(); set => Set(value); }

        public long HashCode { get; }

        public WebSocket(IWebSocketConnection socket)
        {
            this.WebSocketConnection = socket;
            this.HashCode = socket.GetHashCode();
        }

        public WebSocket(IWebSocketConnection socket,String nickName)
        {
            this.WebSocketConnection = socket;
            this.NickName = nickName;
            this.HashCode = socket.GetHashCode();
        }
    }
}
